// Decompiled on 周六 2月 22 19:31:49 CST 2025 with Zomboid Decompiler v0.1.3 using Vineflower.
package zombie.util.list;

import java.util.AbstractList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Objects;
import java.util.RandomAccess;
import java.util.function.Consumer;
import java.util.function.UnaryOperator;

public class PrimitiveFloatList extends AbstractList<Float> implements RandomAccess {
    private final float[] m_array;

    public PrimitiveFloatList(float[] _float) {
        this.m_array = (float[])Objects.requireNonNull(_float);
    }

    public int size() {
        return this.m_array.length;
    }

    public Object[] toArray() {
        return Arrays.asList(this.m_array).toArray();
    }

    public <T> T[] toArray(T[] object) {
        int int0 = this.size();

        for (int int1 = 0; int1 < int0 && int1 < object.length; int1++) {
            Float _float = this.m_array[int1];
            object[int1] = _float;
        }

        if (object.length > int0) {
            object[int0] = null;
        }

        return (T[])object;
    }

    public Float get(int index) {
        return this.m_array[index];
    }

    public Float set(int index, Float element) {
        return this.set(index, element.floatValue());
    }

    public float set(int index, float element) {
        float _float = this.m_array[index];
        this.m_array[index] = element;
        return _float;
    }

    public int indexOf(Object o) {
        if (o == null) {
            return -1;
        } else {
            return o instanceof Number ? this.indexOf(((Number)o).floatValue()) : -1;
        }
    }

    public int indexOf(float val) {
        int int0 = -1;
        int int1 = 0;

        for (int int2 = this.size(); int1 < int2; int1++) {
            if (this.m_array[int1] == val) {
                int0 = int1;
                break;
            }
        }

        return int0;
    }

    public boolean contains(Object o) {
        return this.indexOf(o) != -1;
    }

    public boolean contains(float val) {
        return this.indexOf(val) != -1;
    }

    public void forEach(Consumer<? super Float> action) {
        this.forEach(action::accept);
    }

    public void forEach(FloatConsumer action) {
        int int0 = 0;

        for (int int1 = this.size(); int0 < int1; int0++) {
            action.accept(this.m_array[int0]);
        }
    }

    public void replaceAll(UnaryOperator<Float> operator) {
        Objects.requireNonNull(operator);
        float[] _float = this.m_array;

        for (int _int = 0; _int < _float.length; _int++) {
            _float[_int] = (Float)operator.apply(_float[_int]);
        }
    }

    public void sort(Comparator<? super Float> unused) {
        this.sort();
    }

    public void sort() {
        Arrays.sort(this.m_array);
    }
}
